<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>小叶白菜商城首页</title>
		<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" />
		<script src="js/jquery-1.11.3.min.js" type="text/javascript"></script>
		<script src="js/bootstrap.min.js" type="text/javascript"></script>
	</head>

	<body>
		<div class="container-fluid">

			<!-- 引入header.jsp -->
			<jsp:include page="/WEB-INF/views/header.jsp"></jsp:include>
			<%--<c:import url="header" />--%>

            <!-- 轮播图 -->
            <div class="container-fluid">
                <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                    <!-- 轮播图的中的小点 -->
                    <ol class="carousel-indicators">
                        <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                        <li data-target="#carousel-example-generic" data-slide-to="1"></li>
                        <li data-target="#carousel-example-generic" data-slide-to="2"></li>
                    </ol>
                    <!-- 轮播图的轮播图片 -->
                    <div class="carousel-inner" role="listbox">
                        <div class="item active">
                            <img src="img/1.jpg">
                            <div class="carousel-caption">
                                <!-- 轮播图上的文字 -->
                            </div>
                        </div>
                        <div class="item">
                            <img src="img/2.jpg">
                            <div class="carousel-caption">
                                <!-- 轮播图上的文字 -->
                            </div>
                        </div>
                        <div class="item">
                            <img src="img/3.jpg">
                            <div class="carousel-caption">
                                <!-- 轮播图上的文字 -->
                            </div>
                        </div>
                    </div>

                    <!-- 上一张 下一张按钮 -->
                    <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
                        <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                        <span class="sr-only">Previous</span>
                    </a>
                    <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
                        <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                        <span class="sr-only">Next</span>
                    </a>
                </div>
            </div>

			<!-- 热门商品 -->
			<div class="container-fluid">
				<div class="col-md-12">
					<h2>热门商品&nbsp;&nbsp;<img src="img/title2.jpg"/></h2>
				</div>
				
					<c:forEach items="${hotProduct}" var="hot">
						<div class="col-md-2" style="text-align:center;height:200px;padding:10px 0px;">
							<a href="productInfo?pid=${hot.pid }">
								<img src="${hot.pimage }" width="130" height="130" style="display: inline-block;">
							</a>
							<p><a href="productInfo?pid=${hot.pid }" style='color:#666'>${hot.pname }</a></p>
							<p><font color="#E4393C" style="font-size:16px">&yen;${hot.shop_price }</font></p>
						</div>
					</c:forEach>
			</div>
			
			
			<!-- 最新商品 -->
			<div class="container-fluid">
				<div class="col-md-12">
					<h2>最新商品&nbsp;&nbsp;<img src="img/title2.jpg"/></h2>
				</div>
					<c:forEach items="${newProduct}" var="new">
						<div class="col-md-2 yes-right-border" style="text-align:center;height:200px;padding:10px 0px;">
							<a href="productInfo?pid=${new.pid }">
									<img src="${new.pimage }" width="130" height="130" style="display: inline-block;">
								</a>
								<p><a href="productInfo?pid=${new.pid }" style='color:#666'>${new.pname }</a></p>
								<p><font color="#E4393C" style="font-size:16px">&yen;${new.shop_price }</font></p>
						</div>
					</c:forEach>
			</div>
			
			<!-- 引入footer.jsp -->
			<jsp:include page="/WEB-INF/views/footer.jsp"></jsp:include>
			
		</div>

		<script>
            function get_user_info() {
                $.ajax({
                    type:"post",
                    url:"<c:url value='/user/get_user_info' /> ",
                    data:{},
                    success:function (data) {
                        var result = data.status;
                        if(result == 0){
                            location.href="<c:url value='/user/get_user_info' /> ";
                        }else if(result == 1){
                            confirmModel(data.msg);
                        }
                    }
                })
            }
		</script>


	</body>

</html>